<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SolrClient class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="solrobject.offsetunset.html">SolrObject::offsetUnset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="solrclient.adddocument.html">SolrClient::addDocument</a></div>
 <div class="up"><a href="book.solr.html">Solr</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.solrclient" class="reference">

 <h1 class="title">The SolrClient class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL solr &gt;= 0.9.2)</p>


  <div class="section" id="solrclient.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Used to send requests to a Solr server. Currently, cloning and serialization of SolrClient instances is not supported.
   </p>
  </div>


  <div class="section" id="solrclient.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <strong class="classname">SolrClient</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.search-servlet-type"><var class="varname">SEARCH_SERVLET_TYPE</var></a></var>
     <span class="initializer"> = 1</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.update-servlet-type"><var class="varname">UPDATE_SERVLET_TYPE</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.threads-servlet-type"><var class="varname">THREADS_SERVLET_TYPE</var></a></var>
     <span class="initializer"> = 4</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.ping-servlet-type"><var class="varname">PING_SERVLET_TYPE</var></a></var>
     <span class="initializer"> = 8</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.terms-servlet-type"><var class="varname">TERMS_SERVLET_TYPE</var></a></var>
     <span class="initializer"> = 16</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.default-search-servlet"><var class="varname">DEFAULT_SEARCH_SERVLET</var></a></var>
     <span class="initializer"> = select</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.default-update-servlet"><var class="varname">DEFAULT_UPDATE_SERVLET</var></a></var>
     <span class="initializer"> = update</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.default-threads-servlet"><var class="varname">DEFAULT_THREADS_SERVLET</var></a></var>
     <span class="initializer"> = admin/threads</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.default-ping-servlet"><var class="varname">DEFAULT_PING_SERVLET</var></a></var>
     <span class="initializer"> = admin/ping</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.solrclient.html#solrclient.constants.default-terms-servlet"><var class="varname">DEFAULT_TERMS_SERVLET</var></a></var>
     <span class="initializer"> = terms</span>
    ;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.adddocument.html" class="methodname">addDocument</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.solrinputdocument.html" class="type SolrInputDocument">SolrInputDocument</a></span> <code class="parameter">$doc</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$allowDups</code><span class="initializer"> = false</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$commitWithin</code><span class="initializer"> = 0</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="solrclient.adddocuments.html" class="methodname">addDocuments</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$docs</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$allowDups</code><span class="initializer"> = false</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$commitWithin</code><span class="initializer"> = 0</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.commit.html" class="methodname">commit</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$maxSegments</code><span class="initializer"> = &quot;1&quot;</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$waitFlush</code><span class="initializer"> = true</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$waitSearcher</code><span class="initializer"> = true</span></span>
  ]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="solrclient.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$clientOptions</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.deletebyid.html" class="methodname">deleteById</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$id</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.deletebyids.html" class="methodname">deleteByIds</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$ids</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.deletebyqueries.html" class="methodname">deleteByQueries</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$queries</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.deletebyquery.html" class="methodname">deleteByQuery</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="solrclient.destruct.html" class="methodname">__destruct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="solrclient.getdebug.html" class="methodname">getDebug</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="solrclient.getoptions.html" class="methodname">getOptions</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.optimize.html" class="methodname">optimize</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$maxSegments</code><span class="initializer"> = &quot;1&quot;</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$waitFlush</code><span class="initializer"> = true</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$waitSearcher</code><span class="initializer"> = true</span></span>
  ]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrPingResponse</span><span class="methodname"><a href="solrclient.ping.html" class="methodname">ping</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrQueryResponse</span><span class="methodname"><a href="solrclient.query.html" class="methodname">query</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.solrparams.html" class="type SolrParams">SolrParams</a></span> <code class="parameter">$query</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="solrclient.request.html" class="methodname">request</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$raw_request</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">SolrUpdateResponse</span><span class="methodname"><a href="solrclient.rollback.html" class="methodname">rollback</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="solrclient.setresponsewriter.html" class="methodname">setResponseWriter</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$responseWriter</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="solrclient.setservlet.html" class="methodname">setServlet</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="solrclient.threads.html" class="methodname">threads</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>


  </div>


  <div class="section" id="solrclient.constants">
   <h2 class="title">预定义常量</h2>
   <dl>


    
     <dt id="solrclient.constants.search-servlet-type"><strong><code>SolrClient::SEARCH_SERVLET_TYPE</code></strong></dt>

     <dd>

      <p class="para">Used when updating the search servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.update-servlet-type"><strong><code>SolrClient::UPDATE_SERVLET_TYPE</code></strong></dt>

     <dd>

      <p class="para">Used when updating the update servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.threads-servlet-type"><strong><code>SolrClient::THREADS_SERVLET_TYPE</code></strong></dt>

     <dd>

      <p class="para">Used when updating the threads servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.ping-servlet-type"><strong><code>SolrClient::PING_SERVLET_TYPE</code></strong></dt>

     <dd>

      <p class="para">Used when updating the ping servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.terms-servlet-type"><strong><code>SolrClient::TERMS_SERVLET_TYPE</code></strong></dt>

     <dd>

      <p class="para">Used when updating the terms servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.default-search-servlet"><strong><code>SolrClient::DEFAULT_SEARCH_SERVLET</code></strong></dt>

     <dd>

      <p class="para">This is the intial value for the search servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.default-update-servlet"><strong><code>SolrClient::DEFAULT_UPDATE_SERVLET</code></strong></dt>

     <dd>

      <p class="para">This is the intial value for the update servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.default-threads-servlet"><strong><code>SolrClient::DEFAULT_THREADS_SERVLET</code></strong></dt>

     <dd>

      <p class="para">This is the intial value for the threads servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.default-ping-servlet"><strong><code>SolrClient::DEFAULT_PING_SERVLET</code></strong></dt>

     <dd>

      <p class="para">This is the intial value for the ping servlet.</p>
     </dd>

    

    
     <dt id="solrclient.constants.default-terms-servlet"><strong><code>SolrClient::DEFAULT_TERMS_SERVLET</code></strong></dt>

     <dd>

      <p class="para">This is the intial value for the terms servlet used for the TermsComponent</p>
     </dd>

    

   </dl>

  </div>



 </div>

 






































































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="solrclient.adddocument.html">SolrClient::addDocument</a> — Adds a document to the index</li><li><a href="solrclient.adddocuments.html">SolrClient::addDocuments</a> — Adds a collection of SolrInputDocument instances to the index</li><li><a href="solrclient.commit.html">SolrClient::commit</a> — Finalizes all add/deletes made to the index</li><li><a href="solrclient.construct.html">SolrClient::__construct</a> — Constructor for the SolrClient object</li><li><a href="solrclient.deletebyid.html">SolrClient::deleteById</a> — Delete by Id</li><li><a href="solrclient.deletebyids.html">SolrClient::deleteByIds</a> — Deletes by Ids</li><li><a href="solrclient.deletebyqueries.html">SolrClient::deleteByQueries</a> — Removes all documents matching any of the queries</li><li><a href="solrclient.deletebyquery.html">SolrClient::deleteByQuery</a> — Deletes all documents matching the given query</li><li><a href="solrclient.destruct.html">SolrClient::__destruct</a> — Destructor for SolrClient</li><li><a href="solrclient.getdebug.html">SolrClient::getDebug</a> — Returns the debug data for the last connection attempt</li><li><a href="solrclient.getoptions.html">SolrClient::getOptions</a> — Returns the client options set internally</li><li><a href="solrclient.optimize.html">SolrClient::optimize</a> — Defragments the index</li><li><a href="solrclient.ping.html">SolrClient::ping</a> — Checks if Solr server is still up</li><li><a href="solrclient.query.html">SolrClient::query</a> — Sends a query to the server</li><li><a href="solrclient.request.html">SolrClient::request</a> — Sends a raw update request</li><li><a href="solrclient.rollback.html">SolrClient::rollback</a> — Rollbacks all add/deletes made to the index since the last commit</li><li><a href="solrclient.setresponsewriter.html">SolrClient::setResponseWriter</a> — Sets the response writer used to prepare the response from Solr</li><li><a href="solrclient.setservlet.html">SolrClient::setServlet</a> — Changes the specified servlet type to a new value</li><li><a href="solrclient.threads.html">SolrClient::threads</a> — Checks the threads status</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="solrobject.offsetunset.html">SolrObject::offsetUnset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="solrclient.adddocument.html">SolrClient::addDocument</a></div>
 <div class="up"><a href="book.solr.html">Solr</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
